import 'package:dmz/base/widget/back_image_widget.dart';
import 'package:dmz/base/widget/defult_widget.dart';
import 'package:dmz/business/login/contorller/login_password_controller.dart';
import 'package:dmz/business/login/widgets/login_widgets.dart';
import 'package:dmz/utils/keyboard_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../base/pageWidget/base_stateful_widget.dart';

class PassWordPage extends BaseStatefulWidget<PassWordPageController> {
  @override
  bool showTitleBar() => false;

  @override
  bool onleyShowBackButton() => true;

  @override
  Widget buildContent(BuildContext context) {
    if (Get.arguments != null) controller.isGetCode = Get.arguments as bool;
    debugPrint('页面加载4');
    return GestureDetector(
        onTap: () => KeyboardUtils.hideKeyboard(context),
        child: BackImageWidget(
            child: Column(
                children: [logoWidget(context), snedCodeinputWidgets()])));
  }

  Widget logoWidget(context) {
    return LoginWidgets.logoWidget(context);
  }

  Widget snedCodeinputWidgets() {
    return Column(mainAxisAlignment: MainAxisAlignment.center, children: [
      DefaultText(controller.isGetCode ? '忘记密码'.tr : '设置密码'.tr, 56.sp,
              textColor: Colors.white)
          .marginOnly(bottom: 48.sp),
      controller.isGetCode
          ? Obx(() => LoginWidgets.inputWdiegts(true,
              btnTitle: '下一步'.tr,
              codeType: controller.snedCodeType.value,
              countdownStr: '${controller.counter.value}s',
              photneController: controller.photneController,
              codeController: controller.codeController,
              netxt: controller.checkCode,
              sendCode: controller.snendChagePasswordCode))
          : LoginWidgets.changePasswordInputWdiegts(true,
              btnTitle: '下一步'.tr,
              passwordController: controller.passwordController,
              passwordControllerOther: controller.passwordControllerOther,
              finish: controller.changePassWord)
    ]);
  }
}
